package BC37_网购;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        float price = sc.nextFloat();
        int month = sc.nextInt();
        int day = sc.nextInt();
        int discountCoupon = sc.nextInt();

        if (month == 11 && day == 11) {
            price *= 0.7;
        } else if (month == 12 && day == 12) {
            price *= 0.8;
        }
        if (discountCoupon == 1) {
            price -= 50;
        }
        if (price < 0) {
            System.out.println("0.00");
        } else {
            System.out.printf("%.2f", price);
        }
    }
}
